package com.fjl;

import com.fjl.api.SelfTest;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @DubboReference // 远程调用 Dubbo 服务
//    @DubboReference(version = "1.0.0") // 远程调用 Dubbo 服务
    private HelloService helloService;

    @DubboReference // 远程调用 Dubbo 服务
    private SelfTest selfTest;

    @GetMapping("/hello")
    public String hello(@RequestParam(value = "name") String name) {
        return helloService.sayHello(name);
    }

    @GetMapping("/selfTest")
    public String selfTest(@RequestParam(value = "name") String name) {
        return selfTest.testHello(name);
    }
}
